package com.kkb.utils.util;


import com.alibaba.fastjson.JSON;
import com.kkb.utils.bean.MessageReturn;

import java.util.List;

/**
 * @Author 何世鹏
 * @Date 2021/2/13 2:06
 */
public class MassageReturnUtils {
    public static String toJson(String code, String msg, List<?> data) {
        int count = 0;
        if (data != null) {
            for (Object datum : data) {
                count++;
            }
        }
        MessageReturn m = new MessageReturn(code, msg, count+"", data);
        String s = JSON.toJSONString(m);
        return s;
    }
}
